﻿#region [LoadingControl Using Statements]
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
#endregion

namespace ControlPanelOOB
{
    /// <summary>
    /// UserControl that displays a short repeating animation used
    /// to inform the user that something is loading
    /// </summary>
	public partial class LoadingControl : UserControl
    {
        #region [LoadingControl Constructor]
        /// <summary>
        /// LoadingControl Constructor
        /// </summary>
        public LoadingControl()
		{
			InitializeComponent();
            LoadingStoryboard.Completed += new EventHandler(LoadAnimation_Completed);
		}
        #endregion

        #region [LoadingControl EventHandlers]
        /// <summary>
        /// Event handler triggered when the animation has ended
        /// </summary>
        /// <param name="sender">Who triggered the event</param>
        /// <param name="e">Default EventArgs</param>
        void LoadAnimation_Completed(object sender, EventArgs e)
        {
            LoadingStoryboard.Begin();
        }
        #endregion

        #region [LoadingControl Public Methods]
        /// <summary>
        /// Starts the loading animation
        /// </summary>
        public void StartAnimation()
        {
            LoadingStoryboard.Begin();
        }
        #endregion
    }
}